package com.qc.entity;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Date;

public class UserEntity extends BaseEntity{
	
	protected String userName;
	protected String userPwd;//旧密码
	protected String mobile;
	protected String avatar;
	protected String nickname;
	protected String realName;
	protected String sex;
	protected String userAge;
	protected String jobAge;
	protected String province;
	protected String city;
	protected int userRole;
	protected int isAuth;//是否认证
	protected Timestamp createdTime;
	protected String token;
	protected String deviceId;
	protected String refSource;
	
	//关注数
	private int followNumber;
	//浏览数
	private int browseNumber;
	
	//是否接单状态 0 不接单  1 接单
	private int ordersState;
    
	protected String code;
	protected String newPwd;//新密码
	
	protected String registrationId;//JPush推送ID
	
	protected double balance;//钱包余额
	protected String walletPwd;//钱包密码
	
	//总数
	protected int pageTotal;
	
	
	
	
	public static UserEntity getInstance(ResultSet rs) throws SQLException {
		UserEntity entity = new UserEntity();
		entity.setUserName(rs.getString("user_name"));
		try {
            entity.setUserPwd(rs.getString("user_pwd"));
        } catch (Exception e) {
        }
		entity.setMobile(rs.getString("mobile"));
		entity.setAvatar(rs.getString("avatar"));
		entity.setNickname(rs.getString("nickname"));
		entity.setRealName(rs.getString("real_Name"));
		entity.setSex(rs.getString("sex"));
		entity.setUserAge(rs.getString("user_age"));
		entity.setJobAge(rs.getString("job_age"));
		entity.setProvince(rs.getString("province"));
		entity.setCity(rs.getString("city"));
		entity.setUserRole(rs.getInt("user_role"));
		try {
            entity.setToken(rs.getString("token"));
        } catch (Exception e) {
        }
		entity.setDeviceId(rs.getString("device_id"));
		entity.setRefSource(rs.getString("ref_source"));
		entity.setUserId(rs.getLong("user_id"));
		try {
			entity.setIsAuth(rs.getInt("v_type"));
		} catch (Exception e) {
		}
		entity.setRegistrationId(rs.getString("registrationId"));
		
		entity.setBalance(rs.getDouble("balance"));
		entity.setWalletPwd(rs.getString("wallet_pwd"));
		
		try {
			entity.setOrdersState(rs.getInt("orders_state"));
		} catch (Exception e) {
		}
		
		return entity;
	}
   // Constructors

   /** default constructor */
   public UserEntity() {
   }

	/** minimal constructor */
   public UserEntity(String userName, String userPwd, Timestamp createdTime) {
       this.userName = userName;
       this.userPwd = userPwd;
       this.createdTime = createdTime;
   } 
   
   /** full constructor */
   public UserEntity(String userName, String userPwd, String mobile, String avatar, String nickname,String realName, String sex, String userAge, String jobAge, String province, String city, int userRole, Timestamp createdTime, String token, String deviceId) {
       this.userName = userName;
       this.userPwd = userPwd;
       this.mobile = mobile;
       this.avatar = avatar;
       this.nickname = nickname;
       this.realName = realName;
       this.sex = sex;
       this.userAge = userAge;
       this.jobAge = jobAge;
       this.province = province;
       this.city = city;
       this.userRole = userRole;
       this.createdTime = createdTime;
       this.token = token;
       this.deviceId = deviceId;
   }

  
   // Property accessors

   public String getUserName() {
       return this.userName;
   }
   
   public void setUserName(String userName) {
       this.userName = userName;
   }

   public String getUserPwd() {
       return this.userPwd;
   }
   
   public void setUserPwd(String userPwd) {
       this.userPwd = userPwd;
   }

   public String getMobile() {
       return this.mobile;
   }
   
   public void setMobile(String mobile) {
       this.mobile = mobile;
   }

   public String getAvatar() {
       return this.avatar;
   }
   
   public void setAvatar(String avatar) {
       this.avatar = avatar;
   }

   public String getNickname() {
       return this.nickname;
   }
   
   public void setNickname(String nickname) {
       this.nickname = nickname;
   }

   public String getRealName() {
    return realName;
}

public void setRealName(String realName) {
    this.realName = realName;
}

public String getSex() {
       return this.sex;
   }
   
   public void setSex(String sex) {
       this.sex = sex;
   }

   public String getUserAge() {
       return this.userAge;
   }
   
   public void setUserAge(String userAge) {
       this.userAge = userAge;
   }

   public String getJobAge() {
       return this.jobAge;
   }
   
   public void setJobAge(String jobAge) {
       this.jobAge = jobAge;
   }

   public String getProvince() {
       return this.province;
   }
   
   public void setProvince(String province) {
       this.province = province;
   }

   public String getCity() {
       return this.city;
   }
   
   public void setCity(String city) {
       this.city = city;
   }

   public int getUserRole() {
       return this.userRole;
   }
   
   public void setUserRole(int userRole) {
       this.userRole = userRole;
   }

   public Date getCreatedTime() {
       return this.createdTime;
   }
   
   public void setCreatedTime(Timestamp createdTime) {
       this.createdTime = createdTime;
   }

   public String getToken() {
       return this.token;
   }
   
   public void setToken(String token) {
       this.token = token;
   }

   public String getDeviceId() {
       return this.deviceId;
   }
   
   public void setDeviceId(String deviceId) {
       this.deviceId = deviceId;
   }

	public String getRefSource() {
		return refSource;
	}

	public void setRefSource(String refSource) {
		this.refSource = refSource;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getNewPwd() {
		return newPwd;
	}

	public void setNewPwd(String newPwd) {
		this.newPwd = newPwd;
	}

	public int getIsAuth() {
		return isAuth;
	}

	public void setIsAuth(int isAuth) {
		this.isAuth = isAuth;
	}

	public String getRegistrationId() {
		return registrationId;
	}

	public void setRegistrationId(String registrationId) {
		this.registrationId = registrationId;
	}

    public int getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }

	public double getBalance() {
		return balance;
	}

	public void setBalance(double balance) {
		this.balance = balance;
	}

	public String getWalletPwd() {
		return walletPwd;
	}

	public void setWalletPwd(String walletPwd) {
		this.walletPwd = walletPwd;
	}

	public int getFollowNumber() {
		return followNumber;
	}

	public void setFollowNumber(int followNumber) {
		this.followNumber = followNumber;
	}

	public int getBrowseNumber() {
		return browseNumber;
	}

	public void setBrowseNumber(int browseNumber) {
		this.browseNumber = browseNumber;
	}

	public int getOrdersState() {
		return ordersState;
	}

	public void setOrdersState(int ordersState) {
		this.ordersState = ordersState;
	}

	
}
